//
//  RightViewModel.m
//  DeepBreathing
//
//  Created by rimi on 15/12/21.
//  Copyright © 2015年 rimi. All rights reserved.
//

#import "RightViewModel.h"

#import "RightModel.h"

#import "NetworkManger.h"

#import <UIKit/UIKit.h>

@interface RightViewModel ()

@property(nonatomic,strong)RightModel *model;
//@property(nonatomic,strong)RightModel *rightmodel;

@end
@implementation RightViewModel

-(NSArray *)dataFromModel{
    
    
    return self.model.knowledge[@"data"][@"result"];
}

-(NSInteger)numberOfRows{
    
    
    return [[self dataFromModel] count];
    
    
}
-(NSString *)cellTitleAtIndexPath:(NSIndexPath *)indexPath{
    
    
    return [self dataFromModel][indexPath.section][@"title"];
}

-(NSString *)IdOftheKnowledge:(NSIndexPath *)indexPath{
    
    
    return [self dataFromModel][indexPath.section][@"knowId"];
    
    
}


-(RightModel *)rightmodel{
    
    if (!_model) {
        _model = [[RightModel alloc]init];
    }
    return _model;
}
-(void)getData {
    
    [self.model getData];
    
    
}
-(void)getMoreData{
    
    [self.model getMoreData];
    
}

-(NSString *)observeringKeyPath{
    
    return @"rightmodel.knowledge";
}

-(BOOL)isSuccess{
    
    return ![self.model.knowledge isKindOfClass:[NSNull class]];
    
    
}


@end
